package com.cskaoyan.day10;

public class Test {
    public static void main(String[] args) {
        Grandfather grandfather = new Grandfather();
        grandfather.test();
        Father father = new Father();
        father.test();
        Son son = new Son();
        son.test();

    }
}

class Grandfather {
    int gA = 1;
    int a = 11;

    public Grandfather(int gA, int a) {
        this.gA = gA;
        this.a = a;
    }

    public Grandfather() {
    }

    public void testGrand() {
        System.out.println("grandfather");
    }

    public void test() {
        System.out.println(a);
    }
}

class Father extends Grandfather {
    int fA = 2;
    int a = 22;

    public Father(int gA, int a) {
        super(gA, a);
    }

    public Father(int gA, int a, int fA, int a1) {
        super(gA, a);
        this.fA = fA;
        this.a = a1;
    }

    public Father() {
    }

    public void testFather() {
        System.out.println("Father");
    }

    @Override
    public void test() {
        System.out.println(a);
    }
}

class Son extends Father {
    int sA = 3;
    int a = 33;

    public Son(int gA, int a, int fA, int a1, int sA, int a2) {
        super(gA, a, fA, a1);
        this.sA = sA;
        this.a = a2;
    }

    public Son() {
    }


    public Son(int sA, int a) {
        this.sA = sA;
        this.a = a;
    }

    public void testSon() {
        System.out.println("son");
    }

    @Override
    public void test() {
        System.out.println(a);
    }
}